﻿using Student;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace Student.Tests
{
    
    
    /// <summary>
    ///This is a test class for CourseTest and is intended
    ///to contain all CourseTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CourseTest
    {

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void JoinTestMoreThanOnce()
        {
            Course target = new Course(); // TODO: Initialize to an appropriate value
            Student newStudent = new Student("pesho", 99999); // TODO: Initialize to an appropriate value
            target.Join(newStudent);
            target.Join(newStudent);
        }

        [TestMethod()]
        public void JoinTest()
        {
            Course target = new Course(); // TODO: Initialize to an appropriate value
            Student firstStudent = new Student("pesho", 99999); // TODO: Initialize to an appropriate value
            target.Join(firstStudent);
            Student secondStudent = new Student("gosho", 12001);
            target.Join(secondStudent);
        }


        [TestMethod()]
        public void LeaveTest()
        {
            Course target = new Course(); // TODO: Initialize to an appropriate value
            Student newStudent = new Student("pesho", 99999);
            target.Join(newStudent);
            target.Leave(newStudent);
        }


        [TestMethod()]
        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void LeaveTestWhenItemDoesNotExists()
        {
            Course target = new Course(); // TODO: Initialize to an appropriate value
            Student newStudent = new Student("pesho", 99999);
            target.Leave(newStudent);
        }
    }
}
